package request;

import java.io.OutputStream;
import response.ResponseUpdate;
import core.GameUser;

/**
 * This request sends only a greeting to the server.
 *
 * It's used only for the client user to get a
 * response back from the server, since firewalls
 * and NATs don't allow responses without a request.
 *
 * Request format:
 *
 * @author eric, yiyi
 */
public class RequestHeartbeat extends GameRequest {

    private GameUser user;

    @Override
    public void parse() {
        // Get the sender of this msg
        user = client.getUser();
    }

    @Override
    public void respond(OutputStream output) {
        // Create updateResponse for this sender
        ResponseUpdate response = new ResponseUpdate();
        response.set(gameServer);
        response.setOut(output);
        response.setUser(user);
        response.run();
    }
}